home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Source / CommentedPSCode / Colors < prev    next >
Text File  |  1995-06-12  |  3KB  |  103 lines

  1. %BEGIN Colors
  2.  
  3. % Copyright (C) 1993 David John Burrowes
  4. % Distributed under terms of GNU General Public License.
  5. % See COPYING.text in Convert PICT's CommentedPSCode for a copy
  6.  
  7. %
  8. %    Notes:
  9. %        `foreground' refers to the pixels turned `on' (e.g. black) when drawing a
  10. %        shape, and background refers to those not turned on (e.g. white).
  11. %        These color routines change the 'global' color values defined in the Common
  12. %        file.  Other routines, such as PICTshow and usePattern make use of that data.
  13. %
  14.  
  15. %%%%%%%%%%%%%
  16. %    Name:    fgColor    [000E]
  17. %    Syntax:    [red green blue] fgColor -
  18. %            num fgColor -
  19. %    About:    Given an array storing the three components of an RGB color,
  20. %            set the foregroundColor variable to this color.  If the parameter is
  21. %            not an array, then set the foregroundColor to black (this should never
  22. %            happen, but is provided in case a picture didn't use one of the mac color
  23. %            constants, and you'd want to add PS code to deal)
  24. %%%%%%%%%%%%%
  25. /fgColor
  26. {
  27.     /colorValue exch def
  28.     colorValue type   /arraytype eq
  29.         { /foregroundColor colorValue def}
  30.         { /foregroundColor [0 0 0] def }
  31.     ifelse
  32. } def
  33.  
  34. %%%%%%%%%%%%%
  35. %    Name:    bkColor    [000F]
  36. %    Syntax:    [red green blue] fgColor -
  37. %            num fgColor -
  38. %    About:    Like fgColor, can take an RGB array, or a number representing an
  39. %            unexpected color.  If the former, store in backgroundColor, if the latter,
  40. %            ignore, and set backgroundColor to black.
  41. %%%%%%%%%%%%%
  42. /bkColor
  43. {
  44.     /colorValue exch def
  45.     colorValue type   /arraytype eq
  46.         { /backgroundColor colorValue  def}
  47.         {/backgroundColor [0 0 0] def }
  48.     ifelse
  49. } def
  50.  
  51. %%%%%%%%%%%%%
  52. %    Name:    RGBFgColor    [001A]
  53. %    Syntax:    [red green blue] RGBFgColor -
  54. %    About:    This takes an array of three number that make up an rgb color value.
  55. %            This color value is then stored as the foreground color.
  56. %%%%%%%%%%%%%
  57. /RGBFgCol
  58.     { /foregroundColor exch def } 
  59. def
  60.  
  61. %%%%%%%%%%%%%
  62. %    Name:    RGBBkCol    [001B]
  63. %    Syntax:    [red green blue] RGBBkCol -
  64. %    About:    This takes an array of three number that make up an rgb color value.
  65. %            This color value is then stored as the background color.
  66. %%%%%%%%%%%%%
  67. /RGBBkCol
  68.     { /backgroundColor exch def }
  69. def
  70.  
  71. %%%%%%%%%%%%%
  72. %    Name:    hiliteColor    [001D]
  73. %    Syntax:    [red green blue] hiliteColor -
  74. %    About:    The highlight drawing mode in PICT 2 images appears to allow shape(s)
  75. %            to be drawn with a highlight color.  I'm uncertain of the behavior, and thus
  76. %            am ignoring it for now.
  77. %%%%%%%%%%%%%
  78. /hiliteColor
  79.     { pop }
  80. def
  81.  
  82. %%%%%%%%%%%%%
  83. %    Name:    defHilite    [001E]
  84. %    Syntax:    - defHilite -
  85. %    About:    Inside Mac V, p. 103, implies that this resets the highlight color
  86. %            (see above) with a default value.  This is ignored.
  87. %%%%%%%%%%%%%
  88. /defHilite
  89.     {}
  90. def
  91.  
  92. %%%%%%%%%%%%%
  93. %    Name:    OpColor    [001F]
  94. %    Syntax:    [red green blue] OpColor -
  95. %    About:    This sets a color that is used by some PICT2 drawing modes (e.g. blend)
  96. %            Those modes are not implemented, and so this is ignored.
  97. %%%%%%%%%%%%%
  98. /OpColor
  99.     { pop }
  100. def
  101.  
  102. %END Colors
  103.